package com.krisyu.chainOfResponsibility.COR2;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @DATE 2022/1/5
 * @Author KrisYu
 * @Description
 */
class Client {
    public static void main(String[] args) {
        Random random = new Random();
        List<IWomen> womenList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            womenList.add(new Women(random.nextInt(4), "我要去逛街"));
        }

        // 定义三个请示对象
        Handler father = new Father();
        Handler husband = new Husband();
        Handler son = new Son();
        // 定义请求顺序
        father.setNextHandler(husband);
        husband.setNextHandler(son);

        // 处理妇女请求
        for (IWomen women : womenList) {
            father.handlerMessage(women);
        }
    }
}
